import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-05-13
 * Time: 20:13
 */
public class demo1 {
    public static void main(String[] args) throws IOException {
        File file = new File("test.txt");
        //返回文件对象的父目录文件路径
        System.out.println(file.getParent());
        //返回文件对象的文件路径
        System.out.println(file.getName());
        //返回文件路径
        System.out.println(file.getPath());
        //返回绝对路径
        System.out.println(file.getAbsolutePath());
        //返回经过文本文件修饰过对待绝对路径
        System.out.println(file.getCanonicalPath());
    }
}
